package com.sh.caryr.erp.entity.user;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.sh.caryr.erp.util.DateUtils;
import com.sh.caryr.erp.util.ERPConstants;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@TableName("erp_user_role")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserRole {

    private static final long serialVersionUID = 1L;
    /**
     * 用户角色 id
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;
    /**
     * 公司代码
     */
    private String coco;
    /**
     * 名称
     */
    private String name;
    /**
     * 描述
     */
    private String description;
    /**
     * 用户权限
     */
    @TableField(exist = false)
    private List<UserRoleAuth> authList = new ArrayList<>();
    /**
     * 店铺 id
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long shopId;

    /**
     * 数据是否可用
     */
    private int isActive = ERPConstants.ENITYT_ACTIVE;
    /**
     * 更新日期
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DateUtils.DATE_FORMAT_FULL)
    private Date updateAt;
    /**
     * 更新用户
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long updateBy;
    /**
     * 创建日期
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DateUtils.DATE_FORMAT_FULL)
    private Date createAt;
    /**
     * 创建人
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long createBy;
}
